<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of Detalle_Reserva_Habitacion
 *
 * @author Ivan
 */
class Detalle_Reserva_Habitacion extends CI_Model {
    //put your code here
    var $id;
    var $id_reserva;
    var $id_habitacion;
    var $precio;
    
    function __construct() {
        parent::__construct();
    }
    
    function nuevo()
    {
        $this->id = $_POST['id'];
        $this->id_habitacion = $_POST['id_habitacion'];
        $this->id_reserva = $_POST['id_reserva'];
        $this->precio =$_POST['precio'];
        
        $this->db->trans_start();
        $this->db->insert('t_detalle_reserva_habitacion', $this);        
        $this->db->trans_complete();                
    }
    
    function modificar()
    {        
        $this->id_habitacion = $_POST['id_habitacion'];
        $this->id_reserva = $_POST['id_reserva'];
        $this->precio =$_POST['precio'];
        
        $this->db->trans_start();
        $this->db->update('t_detalle_reserva_habitacion', array('id' => $_POST['id']));        
        $this->db->trans_complete(); 
    }
    
    function eliminar()
    {
        $this->db->trans_start();
        $this->db->delete('t_detalle_reserva_habitacion', array('id' => $_POST['id'])); 
        $this->db->trans_complete();
    }
    
    function getDetalleReservaHabitacion()
    {
        $detalle = $this->db->get_where('t_detalle_reserva_habitacion', array('id'=> $_POST['id']));
        return $detalle;
    }
    
    function listarTodos()
    {
        $detalles = $this->db->get_where('t_detalle_reserva_habitacion', array('id_reserva'=> $_POST['id_reserva']));
        return $detalles;                
    }
}
?>